﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>人次票订单详情</title>
    <link rel="stylesheet" href="css/amazeui.css">
    <script src="js/vue.js"></script>
    <script src="js/jquery-3.2.1.min.js"></script>
    <script src="js/common.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <style>
        * {
            padding: 0;
            border: 0;
            margin: 0;
        }

        .veads_01 {
            height: 6rem;
            width: 100%;
            overflow: hidden;
            padding: 0 3%;
            line-height: 6rem;
            z-index: 999999999;
            position: relative;
            background: #fff;
            border-bottom: 1px solid #d3d3d3;
        }

        .veads1_i1 {
            display: block;
            float: left;
            margin-top: 6%;
            width: 2.5%;
        }

        .veads1_s1 {
            display: block;
            text-align: center;
            font-size: 1.8rem;
        }

        .ordts_01 {
            width: 100%;
            overflow: hidden;
            padding: 0 3%;
        }

        .orde_02 {
            background: #efefef;
            width: 100%;
            padding: 1% 0;
        }

        .orde_03 {
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        /*一下为临时*/
        .veas_10 {
            background: rgba(0,0,0,0.2);
            position: fixed;
            width: 100%;
            height: 100%;
            top: 0;
            z-index: 100000000;
        }

        .veas10_d1 {
            background: #fff;
            width: 100%;
            height: 75%;
            position: absolute;
            bottom: 0;
        }

        .veas10_d2 {
            width: 100%;
            padding: 3% 5%;
            overflow: hidden;
            border-bottom: 1px solid #d3d3d3;
        }

        .veas10_i1 {
            display: block;
            float: left;
            width: 3%;
            margin-top: 0.6%;
            margin-right: 10%;
        }

        .veas10_d3 {
            overflow: hidden;
            float: left;
            width: 25%;
            margin-right: 3%;
        }

        .veas10_s1 {
            height: 2.4rem;
            width: 50%;
            background: #efefef;
            border-radius: 3px;
            display: block;
            float: left;
            margin-right: 10%;
        }

        .veas10_s2 {
            display: block;
            float: left;
            width: 37%;
            margin-top: 4%;
            font-size: 1.2rem;
        }

        .veas10_d4 {
            overflow-y: auto;
            height: 50%;
            width: 100%;
        }

        .veas10_d5 {
            overflow: hidden;
            margin-top: 5%;
            padding-left: 15%;
        }

        .veas10_s3 {
            font-size: 1.2rem;
            display: block;
            margin-right: 2.6%;
            margin-bottom: 10%;
            margin-top: 11%;
            text-align: center;
        }

        .veas10_d6 {
            width: 100%;
            padding: 0 2%;
            overflow: hidden;
        }

        .veas10_s4 {
            font-size: 1.1rem;
            display: block;
            margin-right: 3.3%;
            width: 100%;
            /*margin-bottom: 0.8rem;*/
            height: 2.1rem;
            margin-bottom: 11.7%;
        }

        .veas10_s5 {
            display: block;
            height: 1.8rem;
            /*width: 9%;*/
            background: #efefef;
            border-radius: 5px;
            font-size: 1.1rem;
            text-align: center;
            color: #efefef;
            line-height: 1.8rem;
            float: left;
            margin-right: 1.8%;
            margin-bottom: 2%;
        }

        .veas10_d7 {
            padding: 3% 7%;
            width: 100%;
            margin-top: 1%;
        }

        .veas10_s6 {
            font-size: 2rem;
            display: block;
            margin-bottom: 3%;
        }

        .veas10_d8 {
            width: 10.5rem;
            border: 1px solid #23c788;
            overflow: hidden;
            padding-bottom: 0.3rem;
            float: left;
        }

        .veas10_s7 {
            display: block;
            font-size: 1.4rem;
            color: #727272;
            padding-left: 10%;
        }

        .veas10_s8 {
            display: block;
            color: #ff7676;
            font-size: 1.22rem;
            padding-left: 6%;
        }

        .veas10_i2 {
            display: block;
            float: right;
            margin-top: -20%;
            margin-right: 3%;
            width: 8%;
        }

        .veas10_d9 {
            overflow: hidden;
        }

        .veas10_d10 {
            overflow-x: auto;
        }

        .veas10_but {
            font-size: 1.8rem;
            text-align: center;
            color: #fff;
            background: #dadada;
            position: absolute;
            bottom: 0;
            border-radius: inherit;
            width: 100%;
            padding: 4% 0;
        }

        .veas10_s5_other {
            color: #fff;
            background: #23c788;
        }

        .other_veas10_d {
            height: 1.8rem;
            width: 90%;
            overflow: hidden;
            margin-right: 1.8%;
            margin-bottom: 9%;
            position: relative;
        }

        .other_veas10_s {
            height: 1.8rem;
            border-radius: 5px;
            font-size: 1.1rem;
            text-align: center;
            color: #efefef;
            line-height: 1.8rem;
            background: #23c788;
            position: absolute;
            display: none;
        }

        .veas10_but_other {
            background: #23c788;
        }

        .veas10_d11 {
            margin-bottom: 11.7%;
            border: 1px solid #efefef;
            background: #efefef;
            border-radius: 5px;
            height: 2.1rem;
        }

        .am-g_other {
            background: #23c788;
            color: #fff;
        }

        .vdts_s {
            border-radius: 5px;
            background: #efefef;
        }

        .vdts {
            width: 3.8rem;
        }

        .vedtls {
            background: #23c788;
            color: #fff;
            text-align: center;
            font-size: 0.8rem;
        }

        .veas10_other {
            width: 100%;
            height: 25%;
            position: absolute;
            top: 0;
        }
    </style>
</head>
<body>
    <div id="vult" v-cloak>
        <header data-am-widget="header" class="am-header am-header-default" style="background-color: #FFFFFF; border-bottom: 1px solid rgb(211, 211, 211);">
            <div class="am-header-left am-header-nav" onclick="goBack()">
                <a href="javascript:" class="">
                    <img class="am-header-icon-custom" src="images/veas07.png" alt="" />
                </a>
            </div>
            <h4 class="am-header-title" style=" color: black;">人次票订单详情</h4>
            <div class="am-header-right am-header-nav"><a href="/Wap/Index.html" class="am-header-icon am-icon-home" style="color: #A9A9A9; "></a></div>
        </header>
        <ul class="am-list" style="    margin-bottom: 0.1rem;margin-top: 0">
            <li style="overflow: hidden;border-top: none;padding: 3% 0;color: #747474;font-size: 1.8rem;padding-left: 3%;"><span style="float:left;">用户信息</span></li>
        </ul>
        <div class="ordts_01">
            <ul class="am-list" style="margin-bottom: 0">
                <li style="overflow: hidden;border-top: none;padding: 3% 0;font-weight: 500"><span style="float:left;">用户名</span><span style="float:right;">{{userinfo.nickName}}</span></li>
                <li style="overflow: hidden;;border-bottom: none;padding: 3% 0;font-weight: 500"><span style="float:left;">电话</span><span style="float:right;">{{userinfo.Phone}}</span></li>
            </ul>
        </div>
        <div class="orde_02"></div>
        <ul class="am-list" style="    margin-bottom: 0.1rem;margin-top: 0">
            <li style="overflow: hidden;border-top: none;padding: 3% 0;color: #747474;font-size: 1.8rem;padding-left: 3%;"><span style="float:left;">场地信息</span></li>
        </ul>
        <div class="ordts_01">
            <ul class="am-list" style="margin-bottom: 0">
                <li style="overflow: hidden;border-top: none;padding: 3% 0;font-weight: 500"><span style="float:left;font-size: 1.9rem">{{Venueinfo.Name}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500" v-on:click="toMap()"><span style="float:left;">场馆地址</span><span style="float:right;">{{Venueinfo.Adress}}</span><img src="images/veas03.png" alt="" style="margin-top: 1%;margin-right: 1%;width: 4.2%;float: right;"></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">项目</span><span style="float:right;">{{Sport.Name}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">票名</span><span style="float:right;">{{Ticket.Name}}</span></li>
            </ul>
        </div>
        <div class="orde_02"></div>
        <ul class="am-list" style="    margin-bottom: 0.1rem;margin-top: 0">
            <li style="overflow: hidden;border-top: none;padding: 3% 0;color: #747474;font-size: 1.8rem;padding-left: 3%;"><span style="float:left;">订单信息</span></li>
        </ul>
        <div class="ordts_01" style="margin-bottom: 7rem">
            <ul class="am-list" style="margin-bottom: 0">
                <li style="overflow: hidden;border-top: none;padding: 3% 0;font-weight: 500"><span style="float:left;">订单号</span><span style="float:right;">{{orderinfo.gId}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">订单时间</span><span style="float:right;">{{orderinfo.createTime}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">单价</span><span style="float:right;">{{orderinfo.unitPrice}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">数量</span><span style="float:right;">{{orderinfo.Num}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">总金额</span><span style="float:right;">{{orderinfo.totalPrice}}</span></li>
                <li style="overflow: hidden;padding: 3% 0;font-weight: 500"><span style="float:left;">订单状态</span><span style="float:right;color:#ff9129">{{orderinfo.State=='0'?"未付款":"已付款"}}</span></li>
            </ul>
        </div>
        <div class="orde_03" v-if="orderinfo.State=='0'">
            <!--<button type="button" class="am-btn am-btn-default" v-on:click="cancel" style="float:left;width: 49.9%;border: none;background: #cccccc;color: #fff;height: 5.5rem;">取消</button>-->
            <button type="button" class="am-btn am-btn-default" v-on:click="pay" style="width: 100%; border: none;background: #23c788;color: #fff;height: 5.5rem;">付款</button>
        </div>

    </div>
</body>
</html>
<script>
    $(function () {
        var TicketgId = $.getParam("TicketgId");
        page.TicketgId = TicketgId;
        page.getInfo();
    })

    var page = new Vue({
        el: '#vult',
        data: {
            TicketgId: "",
            orderinfo: [],
            userinfo: [],//用户信息
            Venueinfo: [],//场管信息
            Sport: [],
            Ticket:[],
        },
        methods: {
            getInfo: function () {
                var that = this;
                $.ajax({
                    type: 'POST',
                    url: apiUrl + '/Api/Mine/TicketOrderInfo',
                    data: { "TicketgId": that.TicketgId },
                    success: function (data) {
                        console.log(data.data);
                        if (data.errcode == 0) {
                            that.orderinfo = data.data;
                            that.userinfo = data.userinfo;
                            that.Venueinfo = data.data.Ticket.Venue;
                            that.Sport = data.data.Ticket.Sport;
                            that.Ticket = data.data.Ticket.t;
                        } else {
                            alert(data.errmsg);
                        }
                    },
                    //error: function () {
                    //    alert("服务器加载异常");
                    //}
                })
            },
            toMap: function () {
                location.href = 'map.html?xPoint=' + this.Venueinfo.xPoint + "&yPoint=" + this.Venueinfo.yPoint;
            },
            pay: function () {
                var that = this;
                //if (typeof WeixinJSBridge == "undefined") {
                //    if (document.addEventListener) {
                //        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                //    }
                //    else if (document.attachEvent) {
                //        document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                //        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                //    }
                //}
                //else {
                //    $.ajax({
                //        url: apiUrl + "/Api/Weixin/WeixinPay",
                //        data: { "Id": that.orderid },
                //        type: "POST",
                //        success: function (data) {
                //            if (data.errcode == 0) {
                //                WeixinJSBridge.invoke(
                //                  'getBrandWCPayRequest',
                //                  data.data,
                //                  function (res) {
                //                      if (res.err_msg == "get_brand_wcpay_request:ok") {
                //                          alert("支付成功");
                //                          location.replace(location.href);
                //                      }
                //                  }
                //                );
                //            } else {
                //                alert(data.errmsg);
                //            }

                //        }, error: function () {
                //            alert("响应失败");
                //        }
                //    })

                //}
                //return false;
                $.ajax({
                    url: thisUrl + "/Api/Weixin/TicketNotify",
                    data: { Id: that.TicketgId, money: that.orderinfo.totalPrice },
                    type: "POST",
                    success: function (data) {
                        if (data.errcode == 0) {
                            alert("支付成功");
                            location.replace(location.href);
                        } else {
                            alert(data.errmsg);
                        }
                    },
                    //error: function () {
                    //    alert("服务器响应异常");
                    //}
                })
            },
            //cancel: function () {
            //    var that = this;
            //    $.ajax({
            //        url: thisUrl + "/Api/Field/ReserveOrderCancel",
            //        data: { Id: that.orderid },
            //        type: "POST",
            //        success: function (data) {
            //            if (data.errcode == 0) {
            //                alert("取消成功");
            //                location.replace(location.href);
            //            } else {
            //                alert(data.errmsg);
            //            }
            //        },
            //        error: function () {
            //            alert("服务器响应异常");
            //        }
            //    })
            //}
        }
    });
</script>
